'use strict'

app = angular.module 'app', [
  'ngResource'
  'ui.router'
  'ui.bootstrap'
]
app.config ($stateProvider, $urlRouterProvider) ->

  $urlRouterProvider.when '', '/home'
  $urlRouterProvider.when '/', '/home'
  $urlRouterProvider.otherwise '/err404'

  $stateProvider.state 'home',
    url: '/home'
    controller: 'homeCtrl'
    templateUrl: 'views/home.html'

  $stateProvider.state 'main',
    url: '/main'
    controller: 'mainCtrl'
    templateUrl: 'views/main.html'

  $stateProvider.state 'action1',
    url: '/action1'
    controller: 'action1Ctrl'
    templateUrl: 'views/action/01.html'

  $stateProvider.state 'err404',
    url: '/err404'
    controller: 'err404Ctrl'
    template: '{{name}}'

app.controller 'err404Ctrl', ($scope) ->
  $scope.name = "err404Ctrl"
